package com.lavegue.service.impl;

import java.io.Serializable;
import java.util.List;

import com.lavegue.common.BaseDao;
import com.lavegue.common.BaseService;
import com.lavegue.common.Page;
import com.lavegue.dao.CommentDao;
import com.lavegue.model.Comment;
import com.lavegue.service.CommentService;

/**
 * author: luoweibin
 * date:2011-12-21
 * description:
 *
 */
public class CommentServiceImpl extends BaseService<Comment, Integer, CommentDao> implements CommentService {

	public List<Comment> findCommentsByType(int type) {
		return this.getDao().findCommentsByType(type);
	}

	public List<Comment> findBaodaos() {
		return this.findCommentsByType(Comment.TYPE_BAODAO);
	}

	public List<Comment> findUserComment() {
		return this.findCommentsByType(Comment.TYPE_USER_COMMENT);
	}

	public List<Comment> findWhys() {
		return this.findCommentsByType(Comment.TYPE_WHY);
	}
	
	public Comment findNewGongGao() {
		Comment c = null;
		List<Comment> list = this.getDao().findCommentsByType(Comment.TYPE_GONGGAO);
		if (list != null && !list.isEmpty()) {
			c = list.get(0);
		}
		return c;
	}
	
	//根据类型和标题查询
	 public Page<Comment> getAllCommentByType(int pageNo,int pageSize,String title,int typeId)
	 {
		 return this.getDao().getAllCommentByType(pageNo, pageSize, title, typeId);
	 }
	
}

